|
|||||
|
JCL defines how a job is executed on the mainframe. A job may perform many steps or execute many programs in order to produce the requested information or output. If a segment of JCL is used repeatedly it may be coded once as a PROC (or JCL Procedure) and then used by many different steps within the job. There are two approaches to defining and using PROC's.
The PROC may be defined within the job (this is referred to as an In-stream PROC). If the segment of JCL code being defined as a PROC is unique to a single job then this approach is a very good alternative. An instream PROC should be defined first in the JCL before the EXEC statement that will reference the PROC. An instream PROC must start with a PROC statement and be terminated with a PEND statement. The PEND is not required if the PROC is stored as a separate member in a library.
The PROC may be defined as a separate member and stored in a separate library (i.e. PDS). If the segment of JCL code being defined as a PROC will be used by different jobs then this approach should be used.
At execution time when an EXEC statement references a PROC the PROC source code will be copied into the job and executed as if it is part of the JCL.
If you store a PROC in a library (i.e. Proc Library or ProcLib) the ProcLib must be known to the system. Most systems will search a list of pre-defined ProcLibs to find a PROC. If a PROC is stored in a library that is not in the pre-defined then the PROC will not be found. To specifiy additional PROC libraries to be searched use the JCLLIB statement. This is explained in a later section of this document.
For additional flexibility substitution parameters may be used to pass different values to a PROC. This is explained in a later section of this document.
This example will demonstrate the use of JCL PROCs to create three Partitioned Data Sets (PDS's). The first example will use an instream PROC and the second example will use a JCL member with a separate PROC member. The use of a substitution parameter will also be explained.
The PROC will contain the source code to create (or delete) a PDS using the DSN specified in the substitution parameter ($DSNAME) provided by the JCL member. The JCL member will contain the code to set a substitution parameter with a Data Set Name (or PDS name for this example).
The following is the source code for a JCL member with an instream PROC. Notice the instream PROC is defined before the first step.
//PDSCRTJ4 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2003 All Rights Reserved * //* * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Define a PDS using the IEFBR14 with a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* The JCL member executes the instream PROC called PDSCRTP3 and //* passes a fully qualified data set name (DSN) via the symbolic name //* called DSNAME and referenced in the PROC as &DSNAME.;//* //********************************************************************* //* The instream PROC for creating a PDS. The Data Set Name (&DSNAME) //* is provided by the job step that EXECs the PROC. //* //PDSCRTP3 PROC //PDSCRTS1 EXEC PGM=IEFBR14 //TEMPLIB1 DD DISP=(NEW,CATLG),DSN=&DSNAME, // STORCLAS=MFI, // SPACE=(TRK,(45,15,50)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO) // PEND //* //* ******************************************************************* //* Step 1 of 3 Create a PDS using SET and EXEC //* // SET DSNAME=SIMOTIME.DEMO.TEMP01 //STEPJ41 EXEC PDSCRTP3 //* //* ******************************************************************* //* Step 2 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ42 EXEC PDSCRTP3,DSNAME=SIMOTIME.DEMO.TEMP02 //* //* ******************************************************************* //* Step 3 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ43 EXEC PDSCRTP3,DSNAME=SIMOTIME.DEMO.TEMP03 //*
In the preceding example the PROC starts with the PROC statement and ends with the PEND statement.
//PDSCRTP3 PROC ... ... // PEND
As stated earlier the PEND statement is required for an instream PROC but is optional for a separately defined PROC. Step 1 uses a SET statement to set a value for the DSNAME substitution parameter. Steps 2 and 3 define the DSNAME substitition parameter as part of the EXEC statement. The PROC accesses the substitution parameter by using the ampersand as a prefix or &DSNAME. In this example by using the &DSNAME substitution parameter the PROC may be used to create multiple PDS's with different names.
This example will create three PDS's using a JCL member and a separate PROC member stored in a separate PDS. Notice the use of the JCLLIB statement to tell the system where to find the PROC.
//PDSCRTJ3 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2003 All Rights Reserved * //* * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Define a PDS using the IEFBR14 with a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* The JCLLIB tells the mainframe where to look for PROCs. //* //* The JCL member executes the PROC called PDSCRTP3 and passes a //* fully qualified data set name (DSN) via the symbolic name //* called DSNAME and referenced in the PROC as &DSNAME. //* //********************************************************************* //* //PROCLIB JCLLIB ORDER=SIMOTIME.DEMO.PROCLIB1 //* //* ******************************************************************* //* Step 1 of 3 Create a PDS using SET and EXEC //* // SET DSNAME=SIMOTIME.DEMO.TEMP01 //STEPJ01 EXEC PDSCRTP3 //* //* ******************************************************************* //* Step 2 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ02 EXEC PDSCRTP3,DSNAME=SIMOTIME.DEMO.TEMP02 //* //* ******************************************************************* //* Step 3 of 3 Create a PDS using EXEC and DSNAME substitution //* //STEPJ03 EXEC PDSCRTP3,DSNAME=SIMOTIME.DEMO.TEMP03 //*
The following is the PROC that will be used to create a PDS. Notice the PROC and PEND statements are not required.
//* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2003 All Rights Reserved * //* * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Define a PDS using the IEFBR14 with a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* This PROC needs the &DSNAME defined by the calling JCL member... //* // SET DSNAME=AAAA.BBBB.CCCC //* // EXEC PDSCRTP3 //* //* Also, the JCLLIB statement may be required and placed after //* the JOB card. //* //PROCLIB JCLLIB ORDER=SIMOTIME.DEMO.PROCLIB1 //* //* Technically speaking, IEFBR14 is not a utility program because it //* does nothing. The name is derived from the fact that it contains //* two assembler language instruction. The first instruction clears //* register 15 (which sets the return code to zero) and the second //* instruction is a BR 14 which performs an immediate return to the //* operating system. //* //* IEFBR14's only purpose is to help meet the requirements that a //* job must have at least one EXEC statement. The real purpose is to //* allow the disposition of the DD statement to occur. //* //* For example, the following DISP=(NEW,CATLG) will cause the //* specified DSN (i.e. PDS) to be allocated. //* Note: a PDS may also be referred to as a library. //********************************************************************* //PDSCRTS1 EXEC PGM=IEFBR14 //TEMPLIB1 DD DISP=(NEW,CATLG),DSN=&DSNAME, // STORCLAS=MFI, // SPACE=(TRK,(45,15,50)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO) //*
This section provides an example of how to use a PROC to delete a PDS. Please note, if the PDS is deleted all the members in the PDS are also deleted.
The following is the JCL memebr that will use a PROC to delete the PDS's created in the Create Multiple PDS's example.
//PDSDELJ3 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2003 All Rights Reserved * //* * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Delete Temporary PDS's with IEFBR14 and a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* The JCLLIB tells the mainframe where to look for PROCs. //* //* The JCL member executes the PROC called PDSDELP3 and passes a //* fully qualified data set name (DSN) via the symbolic name //* called DSNAME and referenced in the PROC as &DSNAME.;//* //********************************************************************* //* //PROCLIB JCLLIB ORDER=SIMOTIME.DEMO.PROCLIB1 //* //* ******************************************************************* //* Step 1 of 3 Delete a PDS using SET and EXEC //* // SET DSNAME=SIMOTIME.DEMO.TEMP01 //STEPJ01 EXEC PDSDELP3 //* //* ******************************************************************* //* Step 2 of 3 Delete a PDS using EXEC and DSNAME substitution //* //STEPJ02 EXEC PDSDELP3,DSNAME=SIMOTIME.DEMO.TEMP02 //* //* ******************************************************************* //* Step 3 of 3 Delete a PDS using EXEC and DSNAME substitution //* //STEPJ03 EXEC PDSDELP3,DSNAME=SIMOTIME.DEMO.TEMP03 //*
The following is the PROC that will delete a PDS based on the value of the substitution parameter (&DSNAME) provided by the JCL member.
//* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2003 All Rights Reserved * //* * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Subject: Delete Temporary PDS's with IEFBR14 and a DD Statement //* Author: SimoTime Enterprises //* Date: January 1,1998 //* //* This PROC needs the &DSNAME defined by the calling JCL member... //* // SET DSNAME=AAAA.BBBB.CCCC //* // EXEC PDSDELP3 //* //* Also, the JCLLIB statement may be required and placed after //* the JOB card. //* //PROCLIB JCLLIB ORDER=SIMOTIME.DEMO.PROCLIB1 //* //* Technically speaking, IEFBR14 is not a utility program because it //* does nothing. The name is derived from the fact that it contains //* two assembler language instruction. The first instruction clears //* register 15 (which sets the return code to zero) and the second //* instruction is a BR 14 which performs an immediate return to the //* operating system. //* //* IEFBR14's only purpose is to help meet the requirements that a //* job must have at least one EXEC statement. The real purpose is to //* allow the disposition of the DD statement to occur. //* //* For example, the following DISP=(OLD,DELETE) will cause the //* specified DSN (i.e. PDS) to be deleted. //* Note: a PDS is also referred to as a library. //********************************************************************* //PDSDELS1 EXEC PGM=IEFBR14 //TEMPLIB1 DD DISP=(OLD,DELETE),DSN=&DSNAME, // STORCLAS=MFI, // SPACE=(TRK,(45,15,50)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO) //*
The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem. This suite of JCL members and PROC's is provided as a possible approach to creating and deleting multiple, temporary PDS's.
Permission to use, copy, modify and distribute this software for any non-commercial purpose and without fee is hereby granted, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to Simotime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
You may download this example at http://www.simotime.com/sim4dzip.htm#COBOLBitManipulation as a Z-Pack. The Z-Packs provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.
Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm.
Note: You must be attached to the Internet to download a Z-Pack or view the list.
The hexadecimal dump of the parameter-buffer uses the same technique as describe in another SimoTime example that describes the dumping of a data string using COBOL. The name of the member that does the actual hexadecimal dump is called SimoDUMP. A copy file (PASSDUMP.CPY) is provided for defining the pass area.
The SimoZAPS Utility Program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
Check out The COBOL Connection for more examples of mainframe COBOL coding techniques and sample code.
Check out The SimoTime Library for a wide range of topics for Programmers, Project Managers and Software Developers.
To review all the information available on this site start at The SimoTime Home Page .
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com.
Founded in 1987, SimoTime Enterprises is a privately owned, Limited Liability Corporation located in Novato, California. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complimentary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com.
| Return-to-Top |
| Copyright © 1987-2005 SimoTime Enterprises, LLC All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |